package cn.adolf.carmaster.ui;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.text.Html;
import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import cn.adolf.carmaster.BuildConfig;
import cn.adolf.carmaster.R;
import cn.adolf.carmaster.databinding.FragmentAboutBinding;

/**
 * @Author: 豚豚
 * @Date: 2021年12月14日15:13:05
 */
public class AboutFragment extends Fragment {


    private FragmentAboutBinding binding;

    public AboutFragment() {
    }

    public static AboutFragment newInstance() {
        AboutFragment fragment = new AboutFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        binding = FragmentAboutBinding.inflate(inflater, container, false);
        // return inflater.inflate(R.layout.fragment_about, container, false);
        return binding.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        binding.version.setText(BuildConfig.VERSION_NAME);
        Spanned spanned = Html.fromHtml("开源地址：<a href=https://gitee.com/puffer987/car-master>https://gitee.com/puffer987/car-master</a>");
        binding.opensource.setText(spanned);
        binding.opensource.setMovementMethod(LinkMovementMethod.getInstance());


        Spanned html = Html.fromHtml("特别鸣谢：<a href=https://github.com/cgutman/AdbLib>https://github.com/cgutman/AdbLib</a>");
        binding.thanks.setText(html);
        binding.thanks.setMovementMethod(LinkMovementMethod.getInstance());


    }
}